
using System;
using System.Collections.Generic;
using System.Text;
using NFinal.Extension;

namespace BlackHtml5.WebSite.Models.Entity.Common
{
    public struct admin:NFinal.IModel
    {
		public System.Int64 id;
		public System.String user_name;
		public System.String password;
		public System.String salt;
		public System.Int64? typea;
		#region Nullable
		private bool __is_null__;
        public bool __Is_Null__
        {
            get {
                return __is_null__;
            }
            set
            {
                 __is_null__=value;
            }
        }
        public static implicit operator admin(string __value__)
        {
            var __value2__ = new admin();
            __value2__.__Is_Null__ = __value__==null;
            return __value2__;
        }
        public static  bool operator true(admin __value__)
        {
            return !__value__.__is_null__;
        }
        public static bool operator false(admin __value__)
        {
            return !__value__.__is_null__;
        }
		#endregion
		#region 从get列表初始化实体类
		public static bool TryParse(NFinal.NameValueCollection get,out admin par)
		{
			par=new admin();
			try
			{
						System.Int64.TryParse(get["id"],out par.id);
						par.user_name=get["user_name"];
						par.password=get["password"];
						par.salt=get["salt"];
						par.typea=null;
						if(get["typea"]!=null)
						{
							par.typea=get["typea"].AsVar();
						}
			}
			catch
			{
				return false;
			}
			return true;
		}
		#endregion
		#region 写Json字符串
		public void WriteJson(System.IO.TextWriter tw)
		{
			tw.Write("{");
					tw.Write("\"id\":");
					tw.Write(id.ToString());
					tw.Write(",");
					tw.Write("\"user_name\":");
					tw.Write("\"");
					tw.Write(user_name==null?"null":user_name);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"password\":");
					tw.Write("\"");
					tw.Write(password==null?"null":password);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"salt\":");
					tw.Write("\"");
					tw.Write(salt==null?"null":salt);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"typea\":");
					tw.Write(typea==null?"null" : typea.ToString());

			tw.Write("}");
		}
		#endregion
    }
}
